﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace ETL.Config
{

	public class FTPConfigSection : ConfigurationSection
	{
		[ConfigurationProperty("FTPURLS")]
		public FTPURLCollection FTPURLS
		{
			get { return ((FTPURLCollection)(base["FTPURLS"])); }
		}
	}

	public class FTPConfigElement : ConfigurationElement
	{
		[ConfigurationProperty("name", DefaultValue = "", IsKey = true, IsRequired = true)]
		public string name { get { return ((string)(base["name"])); } set { base["name"] = value; } }

		[ConfigurationProperty("ip", DefaultValue = "", IsKey = false, IsRequired = true)]
		public string ip { get { return ((string)(base["ip"])); } set { base["ip"] = value; } }

		[ConfigurationProperty("username", DefaultValue = "", IsKey = false, IsRequired = true)]
		public string username { get { return ((string)(base["username"])); } set { base["username"] = value; } }

		[ConfigurationProperty("password", DefaultValue = "", IsKey = false, IsRequired = true)]
		public string password { get { return ((string)(base["password"])); } set { base["password"] = value; } }

	}


	[ConfigurationCollection(typeof(FTPConfigElement))]
	public class FTPURLCollection : ConfigurationElementCollection
	{
		protected override ConfigurationElement CreateNewElement()
		{
			return new FTPConfigElement();
		}

		protected override object GetElementKey(ConfigurationElement element)
		{
			return ((FTPConfigElement)(element)).name;
		}

		public FTPConfigElement this[int idx]
		{
			get
			{
				return (FTPConfigElement)BaseGet(idx);
			}
		}

		protected override void BaseAdd(ConfigurationElement element)
		{
			base.BaseAdd(element);
		}

	}

}
